﻿@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<form action="/home/post" method="post" enctype="multipart/form-data">
 
    <label for="file">Exel:</label>
    <input name="file" id="file" type="file">
    <input value="Upload" type="submit">
</form>

<form action="http://localhost:14785/api/upload" enctype="multipart/form-data" method="POST">
    What is your name?
    <input name="submitter" size="40" type="text"><br>
    What file are you uploading?
    <input name="data" size="40" type="file">
    <br>
    <input type="submit">
</form>

<h2>Task Progress</h2>
<p>Progress: <progress id="p" max=100><span>0</span>%</progress></p>

<a href="/Home/Download/">Go to download...</a>

@*<div id="uplBtn">
    <label>
        <span style="display: block">I am button</span>
        <input id="fileupload" type="file" name="files[]" data-url="api/upload/" style="opacity:0;">
    </label>
</div>
<div id="upload-button">
    qwqw
</div>*@

<form  id="form-upload" action="/api/upload" method="post" enctype="multipart/form-data" style="display: none">
    <input id="file-upload" type="file" name="file"/>
</form>

<label id="btn" style="overflow: scroll;position: relative"><span>Загрузить на сервер</span></label>
<div id="bdy"></div>
<div>-------</div>
<script src="/Scripts/work/jquery.iframe-transport.js"></script>
<script src="/Scripts/work/jquery.fileupload.js"></script>
<script src="/Scripts/work/jquery.fileupload-ui.js"></script>
<script src="/Scripts/work/UsefullFunction.js"></script>
<script src="/Scripts/work/upload.js"></script>
<script>
    $(document).ready(function() {
        //$('#fileupload').fileupload();
        //$('#uplBtn').button();
        //$("#upload-button").Upload({
        //    url: "/api/upload"
        //});

       $('#btn').jqxButton({ width: '150', height: '25', theme: 'energyblue' });

       $('#btn').Upload({
            url: "/api/upload"
       });

       //$('#btn').on('click', function () {
       //    fileUpload.initiate();
       //    return false;
       //});
       //$('#file-upload').trigger('click');
    
    //$('#file-upload').on('change', function () {
    //    $('#form-upload').submit();
    //});
});      
   

</script>

<script>
    var progressBar = document.getElementById('p');
    function updateProgress(newValue) {
        progressBar.value = newValue;
        progressBar.getElementsByTagName('span')[0].textContent = newValue;
    }
</script>  

<script type="text/javascript">
    function openExcel(strFilePath) {
        var yourSite = "http://www.yoursite.com";
        openExcelDocPath(yourSite + strFilePath, false);
    }
    function openExcelDocPath(strLocation, boolReadOnly) {
        var objExcel;
        objExcel = new ActiveXObject("Excel.Application");
        objExcel.Visible = true;
        objExcel.Workbooks.Open(strLocation, false, boolReadOnly);
    }
</script>